<template>
    <div id="quotation">
        <div style="width: 100%;height: 85px;background-color: #FAFAFA;padding-top: 1%;">
            <el-col :xs="3" :sm="3" :md="2" :lg="2" style="margin: 0 1% 0 2%">
                <el-input placeholder="客户代号" v-model="CustomerCode"></el-input>
            </el-col>
            <el-col :xs="8" :sm="8" :md="6" :lg="4" style="text-align: left">
                <el-button type="primary" @click="selectTable">查询</el-button>
                <el-button type="success" @click="add">新增报价</el-button>
            </el-col>
        </div>
        <el-table  max-height="600" class="table_quotation" stripe border ref="multipleTable" :data="tableData" tooltip-effect="dark"
                   style="width: 88%;text-align: center !important;">
            <el-table-column prop="index" sortable label="序号" width="100"></el-table-column>
            <el-table-column prop="ID" sortable label="序号ID" v-if="false"></el-table-column>
            <el-table-column prop="CustomerCode" sortable label="客户代号"></el-table-column>
            <el-table-column prop="CustomerName" label="客户名称"></el-table-column>
            <el-table-column prop="CustomerMapNumber" sortable label="图号"></el-table-column>
            <el-table-column prop="MaterialAttribute" label="料号属性"></el-table-column>
            <el-table-column prop="CustomerFile" sortable label="客户文件"></el-table-column>
            <el-table-column prop="ProductDescription" sortable label="产品描述"></el-table-column>
            <el-table-column  label="原辅料">
                <template scope="scope">
                    <el-button size="small" type="warning" @click="MaterielForm(scope.$index, scope.row)">原辅料</el-button>
                </template>
            </el-table-column>
            <el-table-column  label="半成品">
                <template scope="scope">
                    <el-button size="small" type="warning" @click="HalfForm(scope.$index, scope.row)">半成品</el-button>
                </template>
            </el-table-column>
            <el-table-column  label="制造费用">
                <template scope="scope">
                    <el-button size="small" type="primary" @click="MadeForm(scope.$index, scope.row)">制造费用</el-button>
                </template>
            </el-table-column>
            <el-table-column  label="工装费用">
                <template scope="scope">
                    <el-button size="small" type="primary" @click="FrockForm(scope.$index, scope.row)">工装费用</el-button>
                </template>
            </el-table-column>
            <el-table-column  label="统计">
                <template scope="scope">
                    <el-button size="small" type="success" @click="handleTotal(scope.$index, scope.row)">统计</el-button>
                </template>
            </el-table-column>
            <!-- 操作 -->
            <el-table-column prop="ModifyDate" sortable label="时间"></el-table-column>
            <el-table-column prop="OperationUser" sortable label="操作人员ID" v-if="false"></el-table-column>
            <el-table-column prop="OperationUserName" sortable label="操作人员"></el-table-column>
            <!-- 修改和删除 -->
            <el-table-column prop="edit" label="操作" fixed="right" width="180">
                <template scope="scope">
                    <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                    <el-button size="small" type="danger" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页 -->
        <div class="block" style="text-align: right;padding: 4% 1% 0 0">       <!-- , jumper 加到layout里面 前往第 几 页     -->
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-size="PageCount" :page-sizes="[10, 20, 30, 40,50]"
                           :current-page="CurrentPage"  layout="total,sizes, prev, pager, next" :total="Total"></el-pagination>
        </div>
        <!-- 新增报价 -->
        <el-dialog title="新增报价" :visible.sync="dialogFormVisible" >
            <el-form :model="form" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="料号属性" :label-width="formLabelWidth">
                    <el-select v-model="form.MaterialAttribute" placeholder="请选择">
                        <el-option label="新开发" value="1"></el-option>
                        <el-option label="常规" value="2"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="客户代号" :label-width="formLabelWidth">
                    <!-- 客户下拉框 -->
                    <el-select clearable v-model="valueAdd" placeholder="请选择">
                        <el-option v-for="item in CustomerOptionsAdd" :key="item.CustomerCode" :label="item.CustomerName" :value="item.CustomerCode"></el-option>
                    </el-select>
                    <!--<el-input v-model="form.CustomerCode" auto-complete="off" style="width: 85%"></el-input>-->
                </el-form-item>
                <el-form-item label="客户图号" :label-width="formLabelWidth">
                    <el-input v-model="form.CustomerMapNumber" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="产品描述" :label-width="formLabelWidth">
                    <el-input v-model="form.ProductDescription" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="客户文件" :label-width="formLabelWidth">
                    <el-button>上传</el-button>
                    <!--<el-input v-model="form.customerFile" style="width: 85%" auto-complete="off"></el-input>-->
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 编辑 报价 -->
        <el-dialog title="修改报价" :visible.sync="EditFormVisible">
            <el-form :model="formEdit" style="text-align: left;width: 90%;margin: auto">
                <el-form-item label="料号属性" :label-width="formLabelWidth">
                    <el-select v-model="formEdit.MaterialAttribute" placeholder="请选择">
                        <el-option label="新开发" value="新开发"></el-option>
                        <el-option label="常规" value="常规"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="客户代号" :label-width="formLabelWidthEdit">
                    <el-select clearable v-model="formEdit.CustomerCode" placeholder="请选择">
                        <el-option v-for="item in CustomerOptionsEdit" :key="item.CustomerCode" :label="item.CustomerName" :value="item.CustomerCode"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="客户图号" :label-width="formLabelWidthEdit">
                    <el-input v-model="formEdit.CustomerMapNumber" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="产品描述" :label-width="formLabelWidthEdit">
                    <el-input v-model="formEdit.ProductDescription" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="客户文件" :label-width="formLabelWidthEdit">
                    <el-button>修改</el-button>
                    <!--<el-input v-model="formEdit.CustomerFile" style="width: 85%" auto-complete="off"></el-input>-->
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="EditFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="EditForm">提 交</el-button>
            </div>
        </el-dialog>
        <!-- 删除 报价 -->
        <el-dialog title="删除报价" :visible.sync="DeleteVisible">
            <el-form :model="formDelete">
                <el-form-item style="font-size: 18px;">
                    确定删除此报价吗？
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="DeleteVisible = false">取 消</el-button>
                <el-button type="danger" @click="DeleteForm" >确定</el-button>
            </div>
        </el-dialog>

        <!-- 原料辅料  点击按钮 出来原料辅料表格 111111111111  -->
        <el-dialog title="原辅料" :visible.sync="MaterialFormVisible" >
            <el-form :model="formMaterial" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <div style="width: 100%;height: 65px;display: flex;">
                    <div style="flex: 1;text-align: left">
                        <!--客户代号：<div v-model="formMaterial.ID"></div>-->
                    </div>
                    <div style="flex: 1;text-align: right">
                        <el-button type="success" @click="addMaterial">新增原辅料</el-button>
                    </div>
                </div>
                <!-- 原料辅料表格 -->
                <el-table max-height="600" class="table_quotation" stripe border :data="MaterialTable" tooltip-effect="dark"
                           style="width: 100%;text-align: center !important;margin: auto">
                    <el-table-column prop="index" sortable label="序号"></el-table-column>
                    <el-table-column prop="ID" sortable label="序号ID" v-if="false"></el-table-column>
                    <el-table-column prop="PurchaseUnitPrice" sortable label="采购单价"></el-table-column>
                    <el-table-column prop="AmountUsed" sortable label="使用数量"></el-table-column>
                    <el-table-column prop="MaterialCost" label="物料成本"></el-table-column>
                    <el-table-column prop="MOQ" sortable label="MOQ"></el-table-column>
                    <el-table-column prop="ModifyDate" sortable label="修改日期"></el-table-column>
                    <el-table-column prop="OperationUser" sortable label="操作人员ID" v-if="false"></el-table-column>
                    <el-table-column prop="OperationUserName" sortable label="操作人员"></el-table-column>
                    <!-- 修改和删除 -->
                    <el-table-column prop="edit" label="操作">
                        <template scope="scope">
                            <el-button size="small" @click="handleMaterEdit(scope.$index, scope.row)">编辑</el-button>
                            <el-button size="small" type="danger" @click="handleMaterDelete(scope.$index, scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="MaterialFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="MaterialFormVisible = false">确 定</el-button>
                </div>
            </el-form>
        </el-dialog>
        <!-- 新增原辅料   要获取所有的原辅料   -->
        <el-dialog title="新增原辅料" :visible.sync="AddMaterialFormVisible">
            <el-form :model="formMaterialAdd" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="报价代号" :label-width="formLabelWidth">
                    <el-input v-model="formMaterial.ID" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="物料名称" :label-width="formLabelWidth">
                    <!-- 物料名称下拉框 -->
                    <el-select clearable v-model="MaterielAdd" placeholder="请选择">
                        <el-option v-for="item in MaterielOptionsAdd" :key="item.MaterielCode" :label="item.MaterielName" :value="item.MaterielCode"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="使用数量" :label-width="formLabelWidth">
                    <el-input v-model="formMaterialAdd.AmountUsed" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="AddMaterialFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addMaterialForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 修改原料辅料 -->
        <el-dialog title="修改原辅料" :visible.sync="EditMaterialFormVisible">
            <el-form :model="formMaterialEdit" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="报价代号" :label-width="formLabelWidth">
                    <el-input v-model="formMaterialEdit.ID" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="物料名称" :label-width="formLabelWidth">
                    <el-input v-model="formMaterialEdit.MaterielName" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="使用数量" :label-width="formLabelWidth">
                    <el-input v-model="formMaterialEdit.AmountUsed" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="EditMaterialFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="editMaterialForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 删除 原料辅料 -->
        <el-dialog title="删除原辅料" :visible.sync="DeleteMaterialFormVisible">
            <el-form :model="formMaterialDelete">
                <el-form-item style="font-size: 18px;">
                    确定删除此原辅料吗？
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="DeleteMaterialFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="DeleteMaterForm" >确定</el-button>
            </div>
        </el-dialog>

        <!-- 半成品  点击按钮 出来半成品表格  22222222222222 -->
        <el-dialog title="半成品" :visible.sync="HalfFormVisible" >
            <el-form :model="formHalf" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <div style="width: 100%;height: 65px;display: flex;">
                    <div style="flex: 1;text-align: left">
                        <!--客户代号：<div v-model="formMaterial.ID"></div>-->
                    </div>
                    <div style="flex: 1;text-align: right">
                        <el-button type="success" @click="addHalf">新增半成品</el-button>
                    </div>
                </div>
                <!-- 半成品表格 -->
                <el-table max-height="600" class="table_quotation" stripe border :data="HalfTable" tooltip-effect="dark"
                          style="width: 100%;text-align: center !important;margin: auto">
                    <el-table-column prop="index" sortable label="序号"></el-table-column>
                    <el-table-column prop="ID" sortable label="序号ID" v-if="false"></el-table-column>
                    <el-table-column prop="QuotationID" sortable label="报价代号"></el-table-column>
                    <el-table-column prop="AmountUsed" sortable label="使用数量"></el-table-column>
                    <el-table-column prop="MaterialCost" label="物料成本"></el-table-column>
                    <el-table-column prop="MaterielNum" sortable label="物料代号"></el-table-column>
                    <el-table-column prop="MaterielName" sortable label="物料名称"></el-table-column>
                    <el-table-column prop="OperationUser" sortable label="操作人员ID" v-if="false"></el-table-column>
                    <el-table-column prop="OperationUserName" sortable label="操作人员"></el-table-column>
                    <el-table-column prop="ModifyDate" sortable label="日期"></el-table-column>
                    <!-- 修改和删除 -->
                    <el-table-column prop="edit" label="操作">
                        <template scope="scope">
                            <el-button size="small" @click="handleHalfEdit(scope.$index, scope.row)">编辑</el-button>
                            <el-button size="small" type="danger" @click="handleHalfDelete(scope.$index, scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="HalfFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="HalfFormVisible = false">确 定</el-button>
                </div>
            </el-form>
        </el-dialog>
        <!-- 新增 半成品   要获取所有的 半成品 下拉框   -->
        <el-dialog title="新增半成品" :visible.sync="AddHalfFormVisible">
            <el-form :model="formHalfAdd" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="报价代号" :label-width="formLabelWidth">
                    <el-input v-model="formHalf.ID" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="物料名称" :label-width="formLabelWidth">
                    <!-- 物料名称下拉框 -->
                    <el-select clearable v-model="HalfAdd" placeholder="请选择">
                        <el-option v-for="item in HalfOptionsAdd" :key="item.MaterielCode" :label="item.MaterielName" :value="item.MaterielCode"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="使用数量" :label-width="formLabelWidth">
                    <el-input v-model="formHalfAdd.AmountUsed" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="AddHalfFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addHalfForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 修改 半成品 -->
        <el-dialog title="修改半成品" :visible.sync="EditHalfFormVisible">
            <el-form :model="formHalfEdit" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="报价代号" :label-width="formLabelWidth">
                    <el-input v-model="formHalfEdit.ID" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="半成品名称" :label-width="formLabelWidth">
                    <el-input v-model="formHalfEdit.MaterielName" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="使用数量" :label-width="formLabelWidth">
                    <el-input v-model="formHalfEdit.AmountUsed" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="EditHalfFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="editHalfForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 删除 半成品 -->
        <el-dialog title="删除半成品" :visible.sync="DeleteHalfFormVisible">
            <el-form :model="formHalfDelete">
                <el-form-item style="font-size: 18px;">
                    确定删除此半成品吗？
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="DeleteHalfFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="DeleteHalfForm" >确定</el-button>
            </div>
        </el-dialog>

        <!-- 制造费用 3333333》》》》》》》》》默认选中》》》》》》》》》》》》》-->
        <!-- 1、点击按钮  出来制造费用表格 -->
        <el-dialog title="制造费用" :visible.sync="MadeFormVisible" >
            <el-form :model="formMade" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <div style="width: 100%;height: 65px;display: flex;">
                    <div style="flex: 1;text-align: left">
                        <!--客户代号：<div v-model="formMaterial.ID"></div>-->
                    </div>
                    <div style="flex: 1;text-align: right">
                        <el-button type="success" @click="addMade">新增制造费用</el-button>
                    </div>
                </div>
                <!-- 制造 表格 -->
                <el-table max-height="600" class="table_quotation" stripe border :data="MadeTable" tooltip-effect="dark"
                          style="width: 100%;text-align: center !important;margin: auto">
                    <el-table-column prop="index" sortable label="序号"></el-table-column>
                    <el-table-column prop="ID" sortable label="序号ID" v-if="false"></el-table-column>
                    <el-table-column prop="ProcessTime" sortable label="加工工时"></el-table-column>
                    <el-table-column prop="ProcessCount" sortable label="加工次数"></el-table-column>
                    <el-table-column prop="WorkStationName" label="工站名称"></el-table-column>
                    <el-table-column prop="MaterielNum" sortable label="物料代号"></el-table-column>
                    <el-table-column prop="MaterielName" sortable label="物料名称"></el-table-column>
                    <el-table-column prop="OperationUser" sortable label="操作人员ID" v-if="false"></el-table-column>
                    <el-table-column prop="OperationUserName" sortable label="操作人员"></el-table-column>
                    <el-table-column prop="ModifyDate" sortable label="日期"></el-table-column>
                    <!-- 修改和删除 -->
                    <el-table-column prop="edit" label="操作">
                        <template scope="scope">
                            <el-button size="small" @click="handleMadeEdit(scope.$index, scope.row)">编辑</el-button>
                            <el-button size="small" type="danger" @click="handleMadeDelete(scope.$index, scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="MadeFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="MadeFormVisible = false">确 定</el-button>
                </div>
            </el-form>
        </el-dialog>
        <!-- 2、新增 制造费用 -->
        <el-dialog title="新增制造费用" :visible.sync="AddMadeFormVisible">
            <el-form :model="formMadeAdd" style="width: 93%;height: 100%;margin: auto;text-align: left">
                <!-- 计件基础报表 -->
                <el-table max-height="600" class="table_quotation" stripe border :data="PieceTable" tooltip-effect="dark"
                          @selection-change="handleSelectionPiece" style="width: 100%;text-align: center !important;margin: auto">
                    <el-table-column type="selection"></el-table-column>
                    <el-table-column prop="ID" sortable label="序号"></el-table-column>
                    <el-table-column prop="ProcessTime" sortable label="加工工时"></el-table-column>
                    <el-table-column prop="ProcessCount" sortable label="加工次数"></el-table-column>
                    <el-table-column prop="WorkStationNum" label="工站代号"></el-table-column>
                    <el-table-column prop="WorkStationName" label="工站名称"></el-table-column>
                    <el-table-column prop="WorkContent" label="工作内容"></el-table-column>
                    <el-table-column prop="Description" label="工作描述"></el-table-column>
                    <el-table-column prop="MaterielCode" sortable label="物料代号ID"></el-table-column>
                    <el-table-column prop="MaterielNum" sortable label="物料代号"></el-table-column>
                    <el-table-column prop="MaterielName" sortable label="物料名称"></el-table-column>
                    <el-table-column prop="ProcessHours" sortable label="加工工时"></el-table-column>
                    <el-table-column prop="UnitPrice" sortable label="单价"></el-table-column>
                </el-table>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="AddMadeFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addPieceForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 3、修改 制造费用 -->
        <el-dialog title="修改制造费用" :visible.sync="EditMadeFormVisible">
            <el-form :model="formMadeEdit" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="加工次数" :label-width="formLabelWidth">
                    <el-input v-model="formMadeEdit.ProcessCount" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="加工工时" :label-width="formLabelWidth">
                    <el-input v-model="formMadeEdit.ProcessTime" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="EditMadeFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="editMadeForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 4、删除 制造费用 -->
        <el-dialog title="删除制造费用" :visible.sync="DeleteMadeFormVisible">
            <el-form :model="formMadeDelete">
                <el-form-item style="font-size: 18px;">
                    确定删除此制造费用吗？
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="DeleteMadeFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="DeleteMadeForm" >确 定</el-button>
            </div>
        </el-dialog>



        <!-- 工装费用 4444444444  -->
        <!-- 1、点击按钮  出来 工装费用 表格 -->
        <el-dialog title="工装费用" :visible.sync="FrockFormVisible" >
            <el-form :model="formFrock" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <div style="width: 100%;height: 65px;display: flex;">
                    <div style="flex: 1;text-align: left">
                        <!--客户代号：<div v-model="formMaterial.ID"></div>-->
                    </div>
                    <div style="flex: 1;text-align: right">
                        <el-button type="success" @click="addFrock">新增工装费用</el-button>
                    </div>
                </div>
                <!-- 工装 表格 -->
                <el-table max-height="600" class="table_quotation" stripe border :data="FrockTable" tooltip-effect="dark"
                          style="width: 100%;text-align: center !important;margin: auto">
                    <el-table-column prop="index" sortable label="序号"></el-table-column>
                    <el-table-column prop="ID" sortable label="序号ID" v-if="false"></el-table-column>
                    <el-table-column prop="FrockName" sortable label="工装名称"></el-table-column>
                    <el-table-column prop="UsePosition" sortable label="使用位置"></el-table-column>
                    <el-table-column prop="Quantity" label="订单数量"></el-table-column>
                    <el-table-column prop="Price" sortable label="模具/治具价格（元）"></el-table-column>
                    <el-table-column prop="ApportionmentMethod" sortable label="费用分摊方式"></el-table-column>
                    <el-table-column prop="ContributionQuota" sortable label="费用分摊金额"></el-table-column>
                    <el-table-column prop="OperationUser" sortable label="操作人员ID" v-if="false"></el-table-column>
                    <el-table-column prop="OperationUserName" sortable label="操作人员"></el-table-column>
                    <el-table-column prop="ModifyDate" sortable label="日期"></el-table-column>
                    <!-- 修改和删除 -->
                    <el-table-column prop="edit" label="操作">
                        <template scope="scope">
                            <el-button size="small" @click="handleFrockEdit(scope.$index, scope.row)">编辑</el-button>
                            <el-button size="small" type="danger" @click="handleFrockDelete(scope.$index, scope.row)">删除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
                <div slot="footer" class="dialog-footer">
                    <el-button @click="FrockFormVisible = false">取 消</el-button>
                    <el-button type="primary" @click="FrockFormVisible = false">确 定</el-button>
                </div>
            </el-form>
        </el-dialog>
        <!-- 新增 工装费用 -->
        <el-dialog title="新增工装费用" :visible.sync="AddFrockFormVisible">
            <el-form :model="formFrockAdd" style="width: 93%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="报价代号" :label-width="formLabelWidth">
                    <el-input v-model="formFrock.ID" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="工装名称" :label-width="formLabelWidth">
                    <el-input v-model="formFrockAdd.FrockName" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="使用位置" :label-width="formLabelWidth">
                    <el-input v-model="formFrockAdd.UsePosition" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="订单数量" :label-width="formLabelWidth">
                    <el-input v-model="formFrockAdd.Quantity" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="模具/治具价格（元）">
                    <el-input v-model="formFrockAdd.Price" auto-complete="off" style="width: 75%"></el-input>
                </el-form-item>
                <el-form-item label="费用分摊方式" :label-width="formLabelWidth">
                    <!-- 费用分摊方式 下拉框 -->
                    <el-select clearable v-model="formFrockAdd.ApportionmentMethod" placeholder="请选择">
                        <el-option label="客户付费" value="1"></el-option>
                        <el-option label="产品分摊" value="2"></el-option>
                        <el-option label="其他" value="3"></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="AddFrockFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="addFrockForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 修改  工装 -->
        <el-dialog title="修改工装费用" :visible.sync="EditFrockFormVisible">
            <el-form :model="formFrockEdit" style="width: 90%;height: 100%;margin: auto;text-align: left">
                <el-form-item label="工装名称" :label-width="formLabelWidth">
                    <el-input v-model="formFrockEdit.FrockName" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="使用位置" :label-width="formLabelWidth">
                    <el-input v-model="formFrockEdit.UsePosition" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="订单数量" :label-width="formLabelWidth">
                    <el-input v-model="formFrockEdit.Quantity" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="模具/治具价格（元）">
                    <el-input v-model="formFrockEdit.Price" auto-complete="off" style="width: 75%"></el-input>
                </el-form-item>
                <el-form-item label="费用分摊方式" :label-width="formLabelWidth">
                    <!-- 费用分摊方式 下拉框 -->
                    <el-select clearable v-model="formFrockEdit.ApportionmentMethod" placeholder="请选择">
                        <el-option label="客户付费" value="客户付费"></el-option>
                        <el-option label="产品分摊" value="产品分摊"></el-option>
                        <el-option label="其他" value="其他"></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="EditFrockFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="editFrockForm">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 删除 工装 -->
        <el-dialog title="删除工装费用" :visible.sync="DeleteFrockFormVisible">
            <el-form :model="formFrockDelete">
                <el-form-item style="font-size: 18px;">
                    确定删除此工装费用吗？
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="DeleteFrockFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="DeleteFrockForm" >确 定</el-button>
            </div>
        </el-dialog>


        <!-- 统计 费用   5555555555  -->
        <el-dialog title="统计费用" :visible.sync="TotalFormVisible">
            <el-form :model="formTotal" style="margin:auto;width: 90%;">
                <el-form-item label="报价代号" :label-width="formLabelWidth">
                    <el-input v-model="_QuotationID" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="应收报价" :label-width="formLabelWidth">
                    <el-input v-model="formTotal.Y_QuotePrice" :disabled="true" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="实际报价" :label-width="formLabelWidth">
                    <el-input v-model="formTotal.QuotePrice" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
                <el-form-item label="修改备注" :label-width="formLabelWidth">
                    <el-input v-model="formTotal.ReMark" auto-complete="off" style="width: 85%"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="TotalFormVisible = false">取 消</el-button>
                <el-button type="danger" @click="TotalForm" >确定</el-button>
            </div>
        </el-dialog>

    </div>
</template>

<script type="text/ecmascript-6">
    export default{
        data(){
            return {
                //    表格
                tableData:[],
                //   按条件 查询
                CustomerCode: '',
                //     分页
                PageCount:10 ,    // 每页几条   page-size
                CurrentPage:1,   // 当前是第几页
                Total:0,    // 总数
                //    新增 报价
                valueAdd:'',
                dialogFormVisible: false,
                form: {
                    CustomerCode: '',
                    CustomerName:'',
                    Telephone: '',
                    CloseAccountsWay: '',    //  付款方式
                    SendGoodsWay: '',      //  送货方式
                    PackAsk: '',           //  包装要求
                    ReconciliationDate: '',   //  对账周期
                    InvoiceAddress: '',     //  发票地址
                    MonthlyKnotDays: '',    //  月结数字
                },
                formLabelWidth: '120',
                //  新增 所有客户下拉框
                CustomerOptionsAdd:[] ,
                //  修改报价
                CustomerOptionsEdit:[],  //  用户下拉框
                EditFormVisible: false,
                formEdit:{},
                formLabelWidthEdit:'120',
                //  删除报价
                DeleteVisible: false,
                formDelete:{},
                //  原料辅料    11111111111
                MaterialTable:[],    //  表格
                MaterialFormVisible: false,
                formMaterial:{},
                // 新增     原料辅料
                AddMaterialFormVisible: false,
                formMaterialAdd:{
                    "AmountUsed":'',   //
                    "OperationUser":1
                },
                //  物料名称 下拉框
                MaterielOptionsAdd:[],
                MaterielAdd:'',
                //  修改
                EditMaterialFormVisible: false,
                formMaterialEdit:{},
                //  删除
                DeleteMaterialFormVisible: false,
                formMaterialDelete:{},
                //  半成品    2222222222
                HalfTable:[],    //  表格
                HalfFormVisible: false,
                formHalf:{},
                //   新增
                AddHalfFormVisible: false,
                formHalfAdd:{
                    "AmountUsed":'',
                    "OperationUser":1
                },
                HalfOptionsAdd:[],  //  半成品 下拉框
                HalfAdd:'',
                //  修改
                EditHalfFormVisible: false,
                formHalfEdit:{},
                //  删除
                DeleteHalfFormVisible:false,
                formHalfDelete:{},

                //  工装费用  444444444444444
                FrockTable:[],    //  表格
                FrockFormVisible: false,
                formFrock:{},
                //   新增
                AddFrockFormVisible: false,
                formFrockAdd:{
                    "FrockName":'',
                    "UsePosition":'',
                    "Quantity":'',
                    "Price":'',
                    "ApportionmentMethod":'',   //  费用分摊方式
                    "OperationUser":1
                },
                //  修改
                EditFrockFormVisible: false,
                formFrockEdit:{},
                //  删除
                DeleteFrockFormVisible:false,
                formFrockDelete:{},
                //  统计  55555555555
                TotalFormVisible: false,
                formTotal:{
                    //  应
                    Y_QuotePrice:0 ,
                    //  实
                    QuotePrice: 0 ,
                },
                formLabelWidthTotal:'120',
                //  报价号    查询条件
                _QuotationID:0,



                //  制造费用   33333333333      默认选中   ？？？？？？？？？？？？？？？？？？
                MadeTable:[],    //  表格
                MadeFormVisible: false,
                formMade:{},
                //    新增 制造
                AddMadeFormVisible: false,
                formMadeAdd:{
                    "OperationUser":1
                },
                PieceTable:[] ,   //  计件基础报表 表格
                PieceSelection:[],  //  集合
                //  修改
                EditMadeFormVisible: false,
                formMadeEdit:{},
                //  删除
                DeleteMadeFormVisible:false,
                formMadeDelete:{},






            }
        },
        methods: {
            //    分页
            handleSizeChange(val) {
                this.PageCount = val ;   //  每页几条
                this.selectTable();
            },
            handleCurrentChange(val) {
                this.CurrentPage = val ;   // 当前是第几页
                this.selectTable();     //  点击分页的时候
            },
            //   报价  表格
            selectTable(){    // 校验输入信息正确性 ，不对直接  return
                let url = "http://192.168.3.238:8088/QuotationManager/GetQuotationPage?CustomerCode=" + this.CustomerCode + "&PageCount="+this.PageCount+"&CurrentPage="+ this.CurrentPage;
                console.log(url);
                this.$http.get(url,).then(res=>{
                    this.tableData=[];
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.Total = res.data.Total;
                        for(let i=0;i<res.data.ObjList.length;i++){
                            this.tableData.push(res.data.ObjList[i]);
                            res.data.ObjList[i].index=i+1;
                        }
                    }
                    console.log("报价表格")
                    console.log(res)
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //  新增 报价
            //  新增时  获取 所有客户 下拉框
            GetCusSelectionAdd(){    // 校验输入信息正确性 ，不对直接  return
                let url = "http://192.168.3.238:8088/CustomerManager/GetAllCustomer" ;
                console.log(url);
                this.$http.get(url,).then(res=>{
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.CustomerOptionsAdd = res.data.ObjList ;
                    }
                    console.log("客户下拉框")
                    console.log(this.CustomerOptionsAdd)
                }, response => {
                    console.log(" 下拉框添加失败")
                    console.log(response)
                })
            },
            //  新增按钮
            add() {
                console.log("点击新增按钮 ")
                this.GetCusSelectionAdd();
                this.dialogFormVisible = true;
            },
            //  新增 确定按钮
            addForm(){    //   post
                let addUrl = "http://192.168.3.238:8088/QuotationManager/AddQuotation";
                let addForm = {
                    "CustomerCode":this.valueAdd,
                    "CustomerMapNumber":this.form.CustomerMapNumber,     //  图号
                    "ProductDescription":this.form.ProductDescription,   //  描述
                    "CustomerFile":this.form.CustomerFile,  //  文件
                    "MaterialAttribute":this.form.MaterialAttribute,   // 料号属性
                    "OperationUser":1
                };
                console.log("addForm是什么");
                console.log(addForm);
                let that = this ;
                    this.$http.post(addUrl, addForm, {
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        }
                    })
                        .then(function (response) {
                            console.log("添加成功");
                            console.log(response);
                            that.dialogFormVisible = false ;
                            that.selectTable();
                        })
                        .catch(function (error) {
                            console.log("错误");
                            console.log(error);
                        });
                },
            //  修改订单
            // 点击 修改订单 获取  客户下拉框
            GetCusSelectionEdit(){    // 校验输入信息正确性 ，不对直接  return
                let url = "http://192.168.3.238:8088/CustomerManager/GetAllCustomer" ;
                console.log(url);
                this.$http.get(url,).then(res=>{
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.CustomerOptionsEdit = res.data.ObjList ;
                    }
                    console.log("客户下拉框")
                    console.log(this.CustomerOptionsEdit)
                }, response => {
                    console.log(" 下拉框添加失败")
                    console.log(response)
                })
            },
            //  修改  按钮
            handleEdit(index, row) {
                console.log("点击编辑按钮")
                this.GetCusSelectionEdit();
                this.EditFormVisible = true;
                this.formEdit = row ;
                console.log(this.formEdit)
            },
            //  修改订单 确定按钮
            EditForm() {    //   post
                let EditUrl = "http://192.168.3.238:8088/QuotationManager/UpdateQuotation";
                let EditForm1 = {
                    "ID":this.formEdit.ID,   //   ID
                    "CustomerCode":this.formEdit.CustomerCode,   //  客户
                    "CustomerMapNumber":this.formEdit.CustomerMapNumber,     //  图号
                    "ProductDescription":this.formEdit.ProductDescription,  //  描述
                    "CustomerFile":this.formEdit.CustomerFile,  //  文件
                    "MaterialAttribute":this.formEdit.MaterialAttribute,  //  料号属性
                    "OperationUser":1
                };
                console.log("修改订单");
                console.log(EditForm1);
                let that = this ;
                this.$http.post(EditUrl, EditForm1, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.EditFormVisible = false;
                        that.selectTable();
                        console.log("修改成功");
                        console.log(response);
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  删除 订单
            handleDelete(index, row) {
                this.DeleteVisible = true ;
                this.formDelete = row ;
            },
            DeleteForm(){
                let DeleteUrl = "http://192.168.3.238:8088/QuotationManager/DeleteQuotation";
                let deleteItem = {   //  跟后端约定好的JSON格式
                    "ID":this.formDelete.ID,
                    "OperationUser":1
                };
                console.log("删除")
                console.log(DeleteUrl)
                console.log(deleteItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(DeleteUrl, deleteItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (res) {
                        console.log("删除成功")
                        console.log(res)
                        that.DeleteVisible = false;     //  关闭窗口
                        that.selectTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });

            },

            //  原料辅料 按钮  111111
            MaterielForm(index, row){
                this.formMaterial = row;
                this.selectMatTable();
                this.MaterialFormVisible = true ;
                console.log("原辅料")
                console.log(this.formMaterial)
            },
            //   原物料  表格
            selectMatTable(){
                let url = "http://192.168.3.238:8088/QuotationManager/GetQuotationRawMaterial?QuotationID=" + this.formMaterial.ID ;
                console.log("原物料表格");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    this.MaterialTable=[];
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.Total = res.data.Total;
                        for(let i=0;i<res.data.ObjList.length;i++){
                            this.MaterialTable.push(res.data.ObjList[i]);
                            res.data.ObjList[i].index=i+1;
                        }
                    }
                    console.log("物料表格")
                    console.log(res)
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //  新增原料辅料
            //  0、 点击新增按钮
            addMaterial(){
                this.selectAllMaterial();    // 获取所有物料表格
                this.AddMaterialFormVisible = true;
            },
            //  1、 获取 所有物料的 下拉框
            selectAllMaterial(){
                let url = "http://192.168.3.238:8088/MaterielManager/GetMaterielByType?MaterielType=1";
                console.log("所有原物料 下拉框");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.MaterielOptionsAdd = res.data.ObjList ;
                    }
                    console.log("所有原物料 下拉框")
                    console.log(res)
                }, response => {
                    console.log(" 数据获取失败")
                    console.log(response)
                })
            },
            //  2、 点击  新增确定  按钮
            addMaterialForm(){     //   post
                let addUrl = "http://192.168.3.238:8088/QuotationManager/AddQuotationRawMaterial";
                let addForm = {
                    "QuotationID":this.formMaterial.ID,
                    "MaterielCode":this.MaterielAdd ,     //
                    "AmountUsed":this.formMaterialAdd.AmountUsed,   //  使用数量
                    "OperationUser":1
                };
                console.log("addForm是什么");
                console.log(addForm);
                let that = this ;
                    this.$http.post(addUrl, addForm, {
                        headers: {
                            'Content-Type': 'application/x-www-form-urlencoded'
                        }
                    })
                        .then(function (response) {
                            console.log("添加成功");
                            console.log(response);
                            that.AddMaterialFormVisible = false ;
                            that.selectMatTable();
                        })
                        .catch(function (error) {
                            console.log("错误");
                            console.log(error);
                        });
            },
            //  修改原料辅料
            //  1、打开弹框  获取这一行的数据
            handleMaterEdit(index, row) {
                console.log("点击mater编辑按钮")
                this.EditMaterialFormVisible = true;
                this.formMaterialEdit = row ;
                console.log(this.formMaterialEdit)
            },
            //  2、编辑 确定 按钮
            editMaterialForm() {    //   post
                let EditUrl = "http://192.168.3.238:8088/QuotationManager/UpdateQuotationRawMaterial";
                let EditForm1 = {
                    "ID":this.formMaterialEdit.ID,   //   ID
                    "AmountUsed":this.formMaterialEdit.AmountUsed,   //
//                    "MaterialCost":this.formMaterialEdit.MaterialCost,     //
                    "OperationUser":1
                };
                console.log("修改 原料辅料");
                console.log(EditForm1);
                let that = this ;
                this.$http.post(EditUrl, EditForm1, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.EditMaterialFormVisible = false;
                        that.selectMatTable();
                        console.log("修改成功");
                        console.log(response);
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  删除  原物料
            handleMaterDelete(index, row) {
                this.DeleteMaterialFormVisible = true ;
                this.formMaterialDelete = row ;
            },
            DeleteMaterForm(){
                let DeleteUrl = "http://192.168.3.238:8088/QuotationManager/DeleteQuotationRawMaterial";
                let deleteItem = {   //  跟后端约定好的JSON格式
                    "ID":this.formMaterialDelete.ID,
                    "OperationUser":1
                };
                console.log("删除")
                console.log(DeleteUrl)
                console.log(deleteItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(DeleteUrl, deleteItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (res) {
                        console.log("删除成功")
                        console.log(res)
                        that.DeleteMaterialFormVisible = false;     //  关闭窗口
                        that.selectMatTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });

            },

            //  半成品 按钮  222222222
            //  1、点击按钮 弹框出来
            HalfForm(index, row){
                this.formHalf = row;
                this.selectHalfTable();
                this.HalfFormVisible = true ;
                console.log("半成品")
                console.log(this.formHalf.ID)
            },
            //  2、获取半成品表格
            selectHalfTable(){
                let url = "http://192.168.3.238:8088/QuotationManager/GetQuotationSemiManufactures?QuotationID=" + this.formHalf.ID ;
                console.log("半成品表格");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    this.HalfTable=[];
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.Total = res.data.Total;
                        for(let i=0;i<res.data.ObjList.length;i++){
                            this.HalfTable.push(res.data.ObjList[i]);
                            res.data.ObjList[i].index=i+1;
                        }
                    }
                    console.log("半成品表格")
                    console.log(res)
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //  3、新增半成品
            addHalf(){
                this.selectAllHalf();    // 获取所有物料表格
                this.AddHalfFormVisible = true;
            },
            //  3.1  半成品下拉框
            selectAllHalf(){
                let url = "http://192.168.3.238:8088/MaterielManager/GetMaterielByType?MaterielType=3";
                console.log("所有半成品 下拉框");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.HalfOptionsAdd = res.data.ObjList ;
                    }
                    console.log("所有 半成品 下拉框")
                    console.log(res)
                }, response => {
                    console.log(" 数据获取失败")
                    console.log(response)
                })
            },
            //  3.2  半成品 确定按钮
            addHalfForm(){     //   post
                let addUrl = "http://192.168.3.238:8088/QuotationManager/AddQuotationSemiManufactures";
                let addForm = {
                    "QuotationID":this.formHalf.ID,
                    "MaterielCode":this.HalfAdd ,
                    "AmountUsed":this.formHalfAdd.AmountUsed,   //  使用数量
                    "OperationUser":1
                };
                console.log("addForm是什么");
                console.log(addForm);
                let that = this ;
                this.$http.post(addUrl, addForm, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        console.log("添加成功");
                        console.log(response);
                        that.AddHalfFormVisible = false ;
                        that.selectHalfTable();
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  4、修改半成品
            //  4.1、打开弹框  获取这一行的数据
            handleHalfEdit(index, row) {
                console.log("点击 半成品 编辑按钮")
                this.EditHalfFormVisible = true;
                this.formHalfEdit = row ;
                console.log(this.formHalfEdit)
            },
            //  4.2、编辑 确定 按钮
            editHalfForm() {    //   post
                let EditUrl = "http://192.168.3.238:8088/QuotationManager/UpdateQuotationSemiManufactures";
                let EditForm1 = {
                    "ID":this.formHalfEdit.ID,   //   ID
                    "AmountUsed":this.formHalfEdit.AmountUsed,   //
                    "OperationUser":1
                };
                console.log("修改 原料辅料");
                console.log(EditForm1);
                let that = this ;
                this.$http.post(EditUrl, EditForm1, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.EditHalfFormVisible = false;
                        that.selectHalfTable();
                        console.log("修改成功");
                        console.log(response);
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  3、删除半成品
            handleHalfDelete(index, row) {
                this.DeleteHalfFormVisible = true ;
                this.formHalfDelete = row ;
            },
            DeleteHalfForm(){
                let DeleteUrl = "http://192.168.3.238:8088/QuotationManager/DeleteQuotationSemiManufactures";
                let deleteItem = {   //  跟后端约定好的JSON格式
                    "ID":this.formHalfDelete.ID,
                    "OperationUser":1
                };
                console.log("删除")
                console.log(DeleteUrl)
                console.log(deleteItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(DeleteUrl, deleteItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (res) {
                        console.log("删除成功")
                        console.log(res)
                        that.DeleteHalfFormVisible = false;     //  关闭窗口
                        that.selectHalfTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });

            },

            //  1、工装费用 按钮  弹框  444444444
            FrockForm(index, row){
                this.formFrock = row;
                this.selectFrockTable();
                this.FrockFormVisible = true ;
                console.log("工装费用")
                console.log(this.formFrock)
            },
            //  1.2  工装表格
            selectFrockTable(){
                let url = "http://192.168.3.238:8088/QuotationManager/GetQuotationFrock?QuotationID=" + this.formFrock.ID ;
                console.log("工装表格");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    this.FrockTable=[];
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.Total = res.data.Total;
                        for(let i=0;i<res.data.ObjList.length;i++){
                            this.FrockTable.push(res.data.ObjList[i]);
                            res.data.ObjList[i].index=i+1;
                        }
                    }
                    console.log("工装 表格")
                    console.log(res)
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //  1.3、工装费用  新增 按钮
            addFrock(){
//                this.selectAllHalf();    // 获取所有物料表格
                this.AddFrockFormVisible = true;
            },
            //  1.3.1  工装费用  新增  确定按钮
            addFrockForm(){     //   post
                let addUrl = "http://192.168.3.238:8088/QuotationManager/AddQuotationFrock";
                let addForm = {
                    "QuotationID":this.formFrock.ID,
                    "FrockName":this.formFrockAdd.FrockName ,
                    "UsePosition":this.formFrockAdd.UsePosition,   // 使用位置
                    "Quantity":this.formFrockAdd.Quantity,   //订单数量
                    "Price":this.formFrockAdd.Price,   //模具/治具价格（元）
                    "ApportionmentMethod":this.formFrockAdd.ApportionmentMethod,   //  费用分摊方式
                    "OperationUser":1
                };
                console.log("addForm是什么");
                console.log(addForm);
                let that = this ;
                this.$http.post(addUrl, addForm, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        console.log("添加成功");
                        console.log(response);
                        that.AddFrockFormVisible = false ;
                        that.selectFrockTable();
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  1.4、工装费用  修改
            handleFrockEdit(index, row) {
                console.log("点击 工装费用 编辑按钮")
                this.EditFrockFormVisible = true ;
                this.formFrockEdit = row ;
                console.log(this.formFrockEdit)
            },
            //  4.2、编辑 确定 按钮
            editFrockForm() {    //   post
                let EditUrl = "http://192.168.3.238:8088/QuotationManager/UpdateQuotationFrock";
                let EditForm1 = {
                    "ID":this.formFrockEdit.ID,   //   ID
                    "FrockName":this.formFrockEdit.FrockName,   //  工装名称
                    "UsePosition":this.formFrockEdit.UsePosition,   //  使用位置
                    "Quantity":this.formFrockEdit.Quantity,   //  订单数量
                    "Price":this.formFrockEdit.Price,   //  模具/治具价格（元）
                    "ApportionmentMethod":this.formFrockEdit.ApportionmentMethod,   //  费用分摊方式
                    "OperationUser":1
                };
                console.log("修改 工装");
                console.log(EditUrl);
                console.log(EditForm1);
                let that = this ;
                this.$http.post(EditUrl, EditForm1, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.EditFrockFormVisible = false;
                        that.selectFrockTable();
                        console.log("修改成功");
                        console.log(response);
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  1.5、工装费用  删除
            handleFrockDelete(index, row) {
                this.DeleteFrockFormVisible = true ;
                this.formFrockDelete = row ;
            },
            DeleteFrockForm(){
                let DeleteUrl = "http://192.168.3.238:8088/QuotationManager/DeleteQuotationFrock";
                let deleteItem = {   //  跟后端约定好的JSON格式
                    "ID":this.formFrockDelete.ID,
                    "OperationUser":1
                };
                console.log("删除")
                console.log(DeleteUrl)
                console.log(deleteItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(DeleteUrl, deleteItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (res) {
                        console.log("删除成功")
                        console.log(res)
                        that.DeleteFrockFormVisible = false;     //  关闭窗口
                        that.selectFrockTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });

            },

            //  统计  按钮    555555555
            handleTotal(index, row) {
                this.TotalFormVisible = true;
                this._QuotationID = row.ID;
                this.GetTotal();
                console.log("统计按钮 是什么 >>>>>>>>>>>>  ");
                console.log(this._QuotationID)
            },
            //  应 的数据
            GetTotal(){
                let url = "http://192.168.3.238:8088/QuotationManager/GetQuotationFinal?QuotationID=" + this._QuotationID;
                console.log(url);
                this.$http.get(url,).then(response => {
                    // success callback   需要一个alert告诉你查询到了
                    let Code = response.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        for(let i=0;i<response.data.ObjList.length;i++){
                            this.formTotal = response.data.ObjList[i] ;
                        }
                        console.log("formTotal >>>》》》》》》》》》》");
                        console.log(this.formTotal);
                    }
                    console.log("报价 统计  ");
                    console.log(response)
                }, response => {
                    console.log(" 添加失败")
                    console.log(response)
                })
            },
            //  点击 确定按钮
            TotalForm(){
                let Url = "http://192.168.3.238:8088/QuotationManager/UpdateQuotationFinal";
                let Item = {   //  跟后端约定好的JSON格式
                    "ReMark":this.formTotal.ReMark,   //  修改时写明备注
                    "QuotationID":this._QuotationID,
                    "QuotePrice":this.formTotal.QuotePrice,
                    "OperationUser":1,
                };
                console.log("统计  ")
                console.log(Url)
                console.log(Item)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(Url, Item, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.TotalFormVisible = false;     //  关闭窗口
                        console.log("统计修改成功");
                        console.log(response);
//                        that.SelectTimeTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },

            //  1、制造费用 按钮  弹框 333333333333333
            MadeForm(index, row){
                this.formMade = row;
                this.selectMadeTable();
                this.MadeFormVisible = true ;
                console.log("制造费用")
                console.log(this.formMade)
            },
            //  1.1、制造费用  表格
            selectMadeTable(){
                let url = "http://192.168.3.238:8088/QuotationManager/GetQuotationCostProduction?QuotationID=" + this.formMade.ID ;
                console.log("制造费用表格");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    this.MadeTable=[];
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        this.Total = res.data.Total;
                        for(let i=0;i<res.data.ObjList.length;i++){
                            this.MadeTable.push(res.data.ObjList[i]);
                            res.data.ObjList[i].index=i+1;
                        }
                    }
                    console.log("制造费用表格")
                    console.log(res)
                }, response => {
                    console.log(" 表格添加失败")
                    console.log(response)
                })
            },
            //  1.2、制造费用  新增 按钮
            addMade(){
                this.selectPieceTable();    // 获取所有 计件基础报表
                this.AddMadeFormVisible = true;
            },
            //  计件基础报表 表格
            selectPieceTable(){
                let url = "http://192.168.3.238:8088/PieceBasis/GetPieceBasis";
                console.log("计件基础报表");
                console.log(url);
                this.$http.get(url,).then(res=>{
                    this.PieceTable=[];
                    let Code = res.data.Code;
                    if(Code == 200){   // 正常请求到数据
                        for(let i=0;i<res.data.ObjList.length;i++){
                            this.PieceTable.push(res.data.ObjList[i]);
                            res.data.ObjList[i].index=i+1;
                        }
                    }
                    console.log("计件基础报表")
                    console.log(res)
                }, response => {
                    console.log("表格添加失败")
                    console.log(response)
                })
            },
            //  勾选表格
            handleSelectionPiece(val){
                this.PieceSelection = val;
                console.log("勾选集合");
                console.log(this.PieceSelection);
            },
            //  新增 确定按钮
            addPieceForm(){
                let addUrl = "http://192.168.3.238:8088/QuotationManager/AddQuotationCostProduction";
                let addForm = {
                    "QuotationID":this.formMade.ID,
                    "PiecebasisStr":this.PieceSelection ,    //   集合
//                    "ProcessTime":this.PieceSelectionHours,   //  加工工时   集合
                    "OperationUser":1
                };
                console.log("addForm是什么");
                console.log(addForm);
                let that = this ;
                this.$http.post(addUrl, addForm, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        console.log("添加成功");
                        console.log(response);
                        that.AddMadeFormVisible = false ;
                        that.selectMadeTable();
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  1.2.2  制造费用 按钮 》》》》》》》》》》》》》》》》》》》》》》》》》
            handleMadeEdit(index, row) {
                console.log("点击 制造费用 编辑按钮")
                this.EditMadeFormVisible = true ;
                this.formMadeEdit = row ;
                console.log(this.formMadeEdit)
            },
            //  编辑 制造费用 确定 按钮
            editMadeForm(){
                let EditUrl = "http://192.168.3.238:8088/QuotationManager/UpdateQuotationCostProduction";
                let EditForm1 = {
                    "ID":this.formMadeEdit.ID,   //   ID
                    "ProcessCount":this.formMadeEdit.ProcessCount,   //  工装名称
                    "ProcessTime":this.formMadeEdit.ProcessTime,   //  使用位置
                    "OperationUser":1
                };
                console.log("修改 制造");
                console.log(EditUrl);
                console.log(EditForm1);
                let that = this ;
                this.$http.post(EditUrl, EditForm1, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (response) {
                        that.EditMadeFormVisible = false;
                        that.selectMadeTable();
                        console.log("修改成功");
                        console.log(response);
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });
            },
            //  删除
            handleMadeDelete(index, row) {
                this.DeleteMadeFormVisible = true ;
                this.formMadeDelete = row ;
            },
            DeleteMadeForm(){
                let DeleteUrl = "http://192.168.3.238:8088/QuotationManager/DeleteQuotationCostProduction";
                let deleteItem = {   //  跟后端约定好的JSON格式
                    "ID":this.formMadeDelete.ID,
                    "OperationUser":1
                };
                console.log("删除")
                console.log(DeleteUrl)
                console.log(deleteItem)
                let that = this;  //   that管用吗   管用的，想自动刷新就在执行成功的方法里重新  searchTable 就行了
                this.$http.post(DeleteUrl, deleteItem, {
                    headers: {
                        'Content-Type': 'application/x-www-form-urlencoded'
                    }
                })
                    .then(function (res) {
                        console.log("删除成功")
                        console.log(res)
                        that.DeleteMadeFormVisible = false;     //  关闭窗口
                        that.selectMadeTable();
//                        需要提示
                    })
                    .catch(function (error) {
                        console.log("错误");
                        console.log(error);
                    });

            },



            //  1.4、制造费用  删除














            },

            mounted: function () {   //  onload
                this.selectTable();
        }
    }
</script>

<style>
    * {
        padding: 0;
    }

    html,
    body {
        height: 100%;
        width: 100%;
        overflow: hidden;
        margin: 0;
    }

    #quotation {
        height: 100%;
    }
    /* 表头数据居中 */
    .table_quotation thead tr th {
        text-align: center;
    }
</style>